package com.sheng.project.controller;

import com.sheng.project.utils.IpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author liusheng
 * @date 2022/09/06
 */
@Slf4j
@RestController
@RequestMapping("/ip")
public class IpController {

    @GetMapping("/test")
    public void testOne(HttpServletRequest request) {
        String ipAddress = IpUtil.getIpAddress(request);
        log.info("当前 IP 为: {}", ipAddress);
    }
}
